package com.sun.demo02.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/hello")
public class Hello {
    @RequestMapping("/error")
    public String jump2Error(){
        System.out.println("jump2Error");
        return "error";
    }
    @RequestMapping(value = "/success",method= {RequestMethod.GET,RequestMethod.DELETE},headers = {"User-Agent=Safari,Accept-Language=zh-CN"})
    public String jump2Hello(){
        System.out.println("jump2success");
        return "success";
    }

    @RequestMapping(value = "/postForm",method = RequestMethod.POST,params = {"param1","!param2","param3!=3"})
    public String form(){
        System.out.println("getForm");
        return "success";
    }

    @RequestMapping("/pathVariable/{id}")
    public String pathVariableTest(@PathVariable("id") Integer id){
        System.out.println("testPathVariable...id="+id);
        return  "success";
    }

}
